package cn.iocoder.yudao.module.famous.doctor.dal.mysql.attention;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.famous.doctor.dal.dataobject.attention.AttentionDO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.famous.doctor.controller.admin.attention.vo.*;
import org.apache.ibatis.annotations.Param;

/**
 * 我的关注 Mapper
 *
 * @author 启航
 */
@Mapper
public interface AttentionMapper extends BaseMapperX<AttentionDO> {

    default PageResult<AttentionDO> selectPage(AttentionPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<AttentionDO>()
                .eqIfPresent(AttentionDO::getUserId, reqVO.getUserId())
                .betweenIfPresent(AttentionDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(AttentionDO::getId));
    }

    default List<AttentionDO> selectList(AttentionExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<AttentionDO>()
                .eqIfPresent(AttentionDO::getUserId, reqVO.getUserId())
                .betweenIfPresent(AttentionDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(AttentionDO::getId));
    }

    IPage<AttentionPageRespVO> getAttentionMessagePage(Page<Object> objectPage, @Param("param")  AttentionPageReqVO pageVO, @Param("userid") Long userid);
}
